from XmlTool import parse_xml
from Code.XmlDataManager import XmlDataManager

def get_count_greater(dict, cnt):
    res = 0
    for key in dict.keys():
        if dict[key] > cnt:
            print(key)
            res = res + 1
    return res

def get_count_less(dict, cnt):
    res = 0
    for key in dict.keys():
        if dict[key] < cnt:
            print(key)
            res = res + 1
    return res


if __name__ == "__main__":
    path = "../Xml/files.xml"
    XmlDataManager._instance = XmlDataManager()
    parse_xml('../Xml/files.xml')
    result = XmlDataManager._instance.handle_all_data()
    print("最终的结果：")
    print(result)
    print("类别数一共有：")
    print(len(result))
    print("数量小于10的类别有：")
    resCnt = get_count_less(result, 10)
    print("数量小于10的个数为：", resCnt)
    print("数量大于100的类别有：")
    resCnt = get_count_greater(result, 100)
    print("数量大于100的个数为：", resCnt)




